﻿package code
{
	import flashx.textLayout.elements.InlineGraphicElement;
	
	public class GenericEnemy extends GameObject
	{
		// Flag which tells if the enemy has been "reached" in any given level
		protected var triggered:Boolean;
		// Health counter
		protected var health:int;
		
		public function get Triggered():Boolean { return triggered; }
		// Returns the level to which this enemy belongs
		public function get CurrentLevel():Level { return parent as Level; }

		public function GenericEnemy(spawnX:int, spawnY:int, enemyHealth:int)
		{
			super();
			
			this.x = Math.max(Math.min(spawnX, 640 - (this.width / 2)), (this.width / 2));
			this.y = spawnY;
			health = enemyHealth;
			triggered = false;
		}
		
		public override function update():void
		{
			if (triggered)
			{
				super.update();
			}
		}
		
		public function trigger()
		{
			triggered = true;
		}
	}
}